"""Fibonacci sequence generator

Usage: fibonacci(max)

Produces a generator object that iterates until a maximum value is reached.
"""

__author__  = "Avinash Vora"
__version__ = "v 1.0"

def fibonacci(max):
	"""Generates fibonacci numbers using generators"""
	x, y = 0, 1
	while x < max:
		yield x
		x, y = y, x + y
		
if __name__ == "__main__":
	import sys
	
	try:
		argument = sys.argv[1]
		for n in fibonacci(int(argument)):
			print n,
	except:
		print "Usage: fibonacci.py [max]"